home *** CD-ROM | disk | FTP | other *** search
- Path: csus.edu!news
- From: wleong@sfsu.edu (Jerry Leong)
- Newsgroups: comp.lang.c
- Subject: How to pass function as arg?
- Date: Sat, 20 Apr 1996 23:56:19 GMT
- Organization: San Francisco State University
- Message-ID: <317937f7.325108@news.csus.edu>
- NNTP-Posting-Host: wleong@pluto.sfsu.edu
-
- Please don't flame me for asking this question as I have read the faq,
- the newsgroup & I still couldn't find a satisfying answer.
-
- I couldn't quite figure out how to do this. Below is the pseudo-code :
-
- void do_something(void)
- {
- }
-
- void call_this(void func)
- {
- func();
- }
-
- main()
- {
- void (*fp)() = do_something();
- call_this(fp);
- }
-
- Okay, I am quite sure that I got the main() part right. But I'm not
- sure how
- to declare the call_this(func) part. Your pointer is greatly
- appreciated.
-
- Thanx in advance.
-
- p/s: Could this be another good topic for FAQ??
-
-
-